<?php
require_once('lib/utils.php');
require_once('lib/constants.php');
require_once('lib/appparam.php');

?>
<h3>Paramètres éditables</h3>
<div id="param">
	
	<table class="dataTable">
		<thead>
		<tr>
			<th>Clé unique</th>
			<th>Contenu / Valeur</th>
			<th>Type</th>
		</tr>
		</thead>
		<tbody>
		<?php
			$all_param = appparam_get();
			while($param = mysql_fetch_assoc($all_param)) {
				$val = strlen($param['value']) >= 35 ? htmlentities(substr($param['value'],0,32).'...') : $param['value'];
				echo '<tr><td>';
				if($_SESSION['id'] == 1) {
					echo '<img class="edit_param right" id="'.$param['key'].'" src="images/icons/pencil.png" alt="Edit" title="Modifier" />';
				}
				echo $param['key'];
				echo '</td><td>'.$val.'</td><td>'.$param['type'].'</td></tr>';
			}
		?>
		</tbody>
	</table>
</div>

<div id="param_edit" class="hidden">
	<form method="post" action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']); ?>">
	<fieldset>
		<p class="decalhautdouble alignleft">
		<input type="hidden" id="key" />
		<span>Paramètre : <span class="strong" id="param_key"></span></span><br /><br />
		<span>Type : <span class="strong" id="param_type"></span></span><br /><br />
		<span>Contenu / Valeur  :</span><br />
        <textarea name="param_value" id="param_value" class="ui-widget-content" cols="60" rows="15"></textarea>
		</p>
	</fieldset>
	</form>
	<div class="ajax"></div>
</div>

<script src="pages_admin/admin/_admin.js" type="text/javascript"></script>

